package com.ys.filter_interceptor.config;

import com.ys.filter_interceptor.interceptor.MyInterceptor;
import com.ys.filter_interceptor.interceptor.MyInterceptor1;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @program: filter_interceptor
 * @description: 自定义MVC相关配置
 * @author: Henry
 * @create 2020-06-09 19:16
 **/
@Configuration
public class MyMvcConfig implements WebMvcConfigurer {

    @Bean
    public MyInterceptor getMyInterceptor() {
        return new MyInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(getMyInterceptor()).addPathPatterns("/**").order(2);
        registry.addInterceptor(new MyInterceptor1()).addPathPatterns("/**").order(1);
    }
}
